{% extends "base_blank.volt" %}

{% block pageFooter%}
    <script type="text/javascript">
        var bpId = {{ id }};
        var domainPic = '{{ this.di.get('appConfig').application.domainPic }}';
        var urlEditorPT = '{{ url.get('tools/editorPT') }}';
        var urlPbServiceList = '{{ url.get('bpinteract/list') }}';
    </script>
    {{ javascript_include("/assets/manage/js/editor_pt_view.js", false) }}
    {{ javascript_include("/assets/manage/js/bp/addInteract.js", false) }}
{% endblock %}

{% block content %}

<div class="container-fluid" id="content_box_blank">
    <div class="row">
        <div class="col-xs-12">
            <ol class="breadcrumb">
                <li>美容院管理</li>
                <li class="active">添加美粒互动</li>
                <li class="active pull-right"><a href="{{ url.get('bpinteract/list', ['id': id]) }}" class="btn btn-primary btn-xs"><i class="fa fa-chevron-left"></i> 返回</a></li>
            </ol>

            <form id="form_add" class="form-horizontal" role="form" method="post" action="" target="ifr_send_file" enctype="multipart/form-data">
                <input type="hidden" name="callback" value="parent.setFormResult">
                <input type="hidden" name="bp_id" value="{{ id }}">
                <div class="form-group">
                    <label for="content" class="col-xs-2 control-label">内容</label>
                    <div class="col-xs-9">
                        <textarea type="text" class="form-control" id="content" name="content" data-rule="required;" style="min-height: 200px;"></textarea>
                    </div>
                </div>
                <div class="form-group">
            <label for="pics" class="col-xs-2 control-label">图片</label>
            <div class="col-xs-9">
                <div id="bp_photos_box">
                    <div class="input-group paddingTB5">
                        <input type="file" class="form-control" name="pics[]">
                        <div class="input-group-addon bg_red cursor_pointer" onclick="$.bpPhotoDel(this)"><i class="fa fa-times"></i></div>
                    </div>
                    <div class="input-group paddingTB5">
                        <input type="file" class="form-control" name="pics[]">
                        <div class="input-group-addon bg_red cursor_pointer" onclick="$.bpPhotoDel(this)"><i class="fa fa-times"></i></div>
                    </div>
                </div>
                <div>
                    <!-- <p class="help-block pull-left">*支持JPG，PNG，JPEG格式的图片，大小不超过1M，尺寸为：750X350px</p> -->
                    <button type="button" id="but_add_photo" class="btn btn-primary btn-sm pull-right"><i class="fa fa-plus"></i></button>
                </div>
            </div>
            
            {% if user is empty %}
            <div class="form-group">
                    <label for="user" class="col-xs-2 control-label">搜索发布人</label>
                    <div class="col-xs-9">
                        <input type="text" class="form-control search_user" name="search_user" >
                    </div>
            </div>
            <div class="form-group">
                <label for="user_id" class="col-xs-2 control-label">发布人</label>
                <div class="col-xs-9">                 
                    <select name="user_id" class="form-control user_id">
                    	{% for r in userlist %}
                    		<option value="{{ r.user_id }}">{{ r.user_nickname }}</option>
                    	{% endfor %}
                    </select>
                </div>
            </div>
            {% else %}
            <div class="form-group">
                <label for="activity_cover" class="col-xs-2 control-label">发布人</label>
                <div class="col-xs-9"> 
                	<input type="hidden" name="user_id" value="{{ user.user_id }}">
                	<input type="text" class="form-control" name="user_nickname" value="{{ user.user_nickname }}" >                
                </div>
            </div>
            {% endif %}
        </div>
        <div class="form-group">
                <div class="col-xs-12 text-center">
                    <button id="btn_save" type="submit" class="btn btn-primary"><i class="fa fa-floppy-o fa-lg"></i> 保 存</button>
                </div>
            </div>
            </form>
        </div>
    </div>
</div>
{% endblock %}